home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / p4 / p4-1_2a.lha / p4-1.2a / messages_f / sr1_slave.f < prev    next >
Text File  |  1992-10-19  |  1KB  |  56 lines

  1.       subroutine fslave()
  2.  
  3.       include 'p4f.h'
  4.  
  5.       character*500 buffer
  6.       integer type, from, next, done, procid, length
  7.       integer numsl, retcde, recvlen
  8.       integer TAGCNT, TAGDAT, TAGEND
  9.       parameter (TAGCNT = 10)
  10.       parameter (TAGDAT = 20)
  11.       parameter (TAGEND = 30)
  12.  
  13.       numsl = p4ntotids() - 1
  14.       procid = p4myid()
  15.  
  16.       print 200,'slave ',procid,' has started'
  17.  200  format(a,i2,a,/)
  18.       call p4flush()
  19.  
  20.       if (procid .eq. 1) then
  21.          next = 0
  22.       else
  23.          next = procid - 1
  24.       endif
  25.  
  26.       print 201,'slave ',procid,' next = ',next
  27.  201  format(a,i2,a,i2,/)
  28.       call p4flush()
  29.  
  30.       length = 0
  31.       from = -1
  32.       type = TAGCNT
  33.       call p4recv(type,from,buffer,length,recvlen,retcde)
  34.       done = 0
  35.  
  36. 50    if (done .ne. 0) goto 100
  37.  
  38.          buffer = ' '
  39.          length = 500
  40.          from = -1
  41.          type = -1
  42.          call p4recv(type,from,buffer,length,recvlen,retcde)
  43.          if (type .eq. TAGEND) then
  44.             done = 1
  45.          else
  46.             print *,'SLAVE ',procid,' sending msg to ',next
  47.             call p4flush()
  48.             call p4send(TAGDAT,next,buffer,recvlen,retcde)
  49.          endif
  50.          goto 50
  51.  
  52.  
  53. 100   continue
  54.  
  55.       end
  56.